package light.head.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Formula;

/**
 * 帐号类型
 * @author Jian
 */
@Entity
@Table
public class OrganType implements Serializable {

	private static final long serialVersionUID = -640013017285953250L;
	
	private Integer code;
	private String name;
	private Boolean isDefault;				// 是否默认权限
	private Boolean deleted;
	private String des;						// 介绍
	private Date ct = new Date();			// 创建时间
	private Integer cu;						// 创建人
	


	private String cun;						// 创建人姓名
	private Boolean isSon = false;			// 是Son 为TRUE,为了显示用的



	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	
	@Column(length = 50)
	public String getName() {
		return name;
	}
	
	@Column(length = 1000)
	public String getDes() {
		return des;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	
	@Column
	public Integer getCu() {
		return cu;
	}
	
	@Column
	public Boolean getIsDefault() {
		return isDefault;
	}
	
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCun() {
		return cun;
	}
	public Boolean getIsSon() {
		return isSon;
	}
	
	

	
	
	
	
	
	
	
	
	
	
	
	

	public void setIsSon(Boolean isSon) {
		this.isSon = isSon;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setDes(String des) {
		this.des = des;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCun(String cun) {
		this.cun = cun;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setIsDefault(Boolean isDefault) {
		this.isDefault = isDefault;
	}
}
